package com.learn.hibernatevalidator.chapter03.parameterscriptassert;

import org.hibernate.validator.constraints.ParameterScriptAssert;

import java.util.List;

/**
 * @author: liyf
 * @create: 2025-01-04 21:27
 **/
public class Car {

    @ParameterScriptAssert(lang = "groovy", script = "luggage.size() <= passengers.size() * 2")
    public void load(List<Person> passengers, List<PieceOfLuggage> luggage) {
        System.out.println("Person.load");
    }

    @ParameterScriptAssert(lang = "python", script = "len(luggage) <= len(passengers) * 2")
    public void load2(List<Person> passengers, List<PieceOfLuggage> luggage) {
        System.out.println("Person.load");
    }

    @ParameterScriptAssert(lang = "javascript", script = "luggage.length <= passengers.length * 2")
    public void load3(List<Person> passengers, List<PieceOfLuggage> luggage) {
        System.out.println("Person.load");
    }
}
